import Vue from 'vue'
import Vuex from 'vuex'

import { createPersistedState, createSharedMutations } from 'vuex-electron'

// import modules from './modules'

Vue.use(Vuex)

export default new Vuex.Store({
  // modules,
  state :{
    userIfo:null,
    isLogin:false, //默认没有登录
  },
  getters:{
    getuserInfo:(state)=>{
      return state.userIfo;
    },
    showlogin:(state)=>{
      return state.isLogin;
    }
  },
  mutations:{
    SET_USERINFO(state,value){
      state.userIfo=value
    },
    UP_LOGINSTATUS(state,value){
      state.isLogin=value
    }
  },
  actions:{
    setUserInfo({commit},data){
     
      commit("SET_USERINFO", data);
    },
    upLoginState({commit},data){
      commit("UP_LOGINSTATUS", data);
    }
  },
  plugins: [
    createPersistedState(),
    createSharedMutations()
  ],
  strict: process.env.NODE_ENV !== 'production'
})
